<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="支付订单号">
              <a-input placeholder="请输入支付订单号" v-model="queryParam.payOrderNo"></a-input>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="买家昵称">
              <a-input placeholder="请输入买家昵称" v-model="queryParam.nickname"></a-input>
            </a-form-item>
          </a-col>
          <template v-if="toggleSearchStatus">
            <a-col :xl="6" :lg="7" :md="8" :sm="24">
              <a-form-item label="审核状态">
                <!-- <a-input placeholder="请输入1=待审核，2=审核通过，3=审核拒绝" v-model="queryParam.status"></a-input> -->
                <j-dict-select-tag v-model="queryParam.status" dictCode="examine_status"  />
              </a-form-item>
            </a-col>
            <a-col :xl="6" :lg="7" :md="8" :sm="24">
              <a-form-item label="支付时间">
                <a-range-picker format="YYYY-MM-DD" :placeholder="['开始时间', '结束时间']" @change="onDateChange" />
              </a-form-item>
            </a-col>
          </template>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
              <a-button type="primary" icon="download" style="margin-left: 8px" @click="handleExportXls('大额支付')">导出</a-button>
              <!-- <a @click="handleToggleSearch" style="margin-left: 8px">
                {{ toggleSearchStatus ? '收起' : '展开' }}
                <a-icon :type="toggleSearchStatus ? 'up' : 'down'" />
              </a> -->
            </span>
          </a-col>
        </a-row>
      </a-form>
    </div>
    <!-- 查询区域-END -->

    <!-- 操作按钮区域 -->
    <!-- <div class="table-operator">

      <a-button type="primary" icon="download" @click="handleExportXls('大额支付')">导出</a-button>

    </div> -->

    <!-- table区域-begin -->
    <div>
      <!-- <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
        <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
        <a style="margin-left: 24px" @click="onClearSelected">清空</a>
      </div> -->

      <a-table ref="table" size="middle" :scroll="{x:true}" bordered rowKey="id" :columns="columns" :dataSource="dataSource" :pagination="ipagination"
        :loading="loading" class="j-table-force-nowrap" @change="handleTableChange">

        <template slot="member" slot-scope="text, record">
          {{record.member.nickname}}
        </template>
        <template slot="omsPayOrderAmount" slot-scope="text, record">
          {{record.payAmount|numToFixed2}}
        </template>

        <template slot="htmlSlot" slot-scope="text">
          <div v-html="text"></div>
        </template>

        <template slot="imgSlot" slot-scope="text">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
          <img v-else :src="getImgView(text)" height="55px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;" />
        </template>
        <template slot="fileSlot" slot-scope="text">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
          <a-button v-else :ghost="true" type="primary" icon="download" size="small" @click="downloadFile(text)">
            下载
          </a-button>
        </template>

        <span slot="action" slot-scope="text, record">
          <a @click="handleDetail(record)">查看</a>
          <a-divider v-if="record.status==1" type="vertical" />
          <a v-if="record.status==1" @click="handleSure(record)">确认收款</a>
          <a-divider v-if="record.status==1" type="vertical" />
          <a v-if="record.status==1" @click="handleRefuse(record)">拒绝</a>

        </span>

      </a-table>
    </div>

    <oms-pay-offline-modal ref="modalForm" @ok="modalFormOk"></oms-pay-offline-modal>
  </a-card>
</template>

<script>

import '@/assets/less/TableExpand.less'
import { mixinDevice } from '@/utils/mixin'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import OmsPayOfflineModal from './modules/OmsPayOfflineModal'
import JDictSelectTag from '@/components/dict/JDictSelectTag.vue'
import JDate from '@/components/jeecg/JDate.vue'

export default {
  name: 'OmsPayOfflineList',
  mixins: [JeecgListMixin, mixinDevice],
  components: {
    JDictSelectTag,
    JDate,
    OmsPayOfflineModal
  },
  data () {
    return {
      description: '大额支付管理页面',
      // 表头
      columns: [
        {
          title: '#',
          dataIndex: '',
          key: 'rowIndex',
          width: 60,
          align: "center",
          customRender: function (t, r, index) {
            return parseInt(index) + 1
          }
        },
        {
          title: '类型',
          align: "center",
          dataIndex: 'payType_dictText'
        },
        {
          title: '支付订单号',
          align: "center",
          dataIndex: 'payOrderNo'
        },
        {
          title: '买家昵称',
          align: "left",
          dataIndex: 'nickname'
        },
        {
          title: '订单金额',
          align: "right",
          dataIndex: 'payAmount',
          scopedSlots: { customRender: 'omsPayOrderAmount' }
        },
        {
          title: '打款账户类型',
          align: "center",
          dataIndex: 'type_dictText'
        },
        {
          title: '持卡人姓名',
          align: "center",
          dataIndex: 'accountName'
        },
        {
          title: '开户行',
          align: "center",
          dataIndex: 'bankAccount'
        },
        {
          title: '银行卡号',
          align: "center",
          dataIndex: 'accountNumber'
        },
        {
          title: '支付',
          align: "center",
          dataIndex: 'createTime'
        },
        {
          title: '审核状态',
          align: "center",
          dataIndex: 'status_dictText'
        },
        // {
        //   title: '拒绝原因',
        //   align: "center",
        //   dataIndex: 'refuseReason'
        // },
        {
          title: '操作',
          dataIndex: 'action',
          align: "left",
          fixed: "right",
          width: 147,
          scopedSlots: { customRender: 'action' }
        }
      ],
      url: {
        list: "/mallBase/omsPayOffline/list",
        delete: "/mallBase/omsPayOffline/delete",
        deleteBatch: "/mallBase/omsPayOffline/deleteBatch",
        exportXlsUrl: "/mallBase/omsPayOffline/exportXls",
        importExcelUrl: "mallBase/omsPayOffline/importExcel",

      },
      dictOptions: {},
    }
  },
  created () {
  },
  computed: {
    importExcelUrl: function () {
      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
    },
  },
  methods: {
    handleSure (record) {
      this.$refs.modalForm.edit(record, 1)
      this.$refs.modalForm.title = "确认收款"
      this.$refs.modalForm.disableSubmit = false

    },
    handleRefuse (record) {
      this.$refs.modalForm.edit(record, 2)
      this.$refs.modalForm.title = "确定要拒绝此大额支付申请吗？"
      this.$refs.modalForm.disableSubmit = false

    },
    initDictConfig () {
    }
  }
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>